package cn.jt;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;
import java.util.List;

public class MybatisDemo03 {
    public static void main(String[] args) throws Exception{
        InputStream in = Resources.getResourceAsStream( "mybatis-config.xml" );

        SqlSessionFactory fac = new SqlSessionFactoryBuilder().build( in );

        SqlSession session = fac.openSession();

        List<Emp> list = session.selectList( "EmpMapper.findAll" );

        for (Emp emp : list) {

            System.out.println( emp );
        }

    }

}
